package com.candy.control;

import com.candy.pojo.UserBean;
import com.candy.service.UserInfoService;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;

@WebServlet("/addUserInfo")
public class UserInfoAddServlet extends HttpServlet {
    @Override
    protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        System.out.println("访问后台成功............");
//        设置字符集，处理中文乱码问题
        req.setCharacterEncoding("UTF-8");
        resp.setCharacterEncoding("UTF-8");
//调用业务逻辑处理层进行业务处理
        UserInfoService userInfoService=new UserInfoService();
       String username= req.getParameter("username");
       String userpwd= req.getParameter("userpwd");
       String useraddress= req.getParameter("useraddress");
       String userTel=  req.getParameter("usertel");
       userInfoService.addUserInfo(username,userpwd,useraddress,userTel);
//           若用户名密码正确，则跳转到登录成功页面
       req.getRequestDispatcher("WEB-INF/userManger/userInfoQuery.jsp").forward(req,resp);





    }
}
